package team.archai.nexus.boot.web.config;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import team.archai.nexus.boot.web.interceptors.SecureInterceptor;

import javax.annotation.Resource;

/**
 * @description: 配置拦截器
 * @author: lishibin
 * @create: 2020-07-08 23:25
 **/
@Component
@ConditionalOnProperty(name = "archai-nexus.secure.enabled", havingValue = "true")
public class SecureConfig implements WebMvcConfigurer {

    @Resource
    private SecureInterceptor secureInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(secureInterceptor);
    }
}
